//
// Created by Felix on 24-4-25.
//

#ifndef GAZE_SWAGGERCOMPONENT_HPP
#define GAZE_SWAGGERCOMPONENT_HPP

#include "oatpp/core/macro/component.hpp"

/**
 * swagger组件
 */
class SwaggerComponent {
public:
    OATPP_CREATE_COMPONENT(
            std::shared_ptr<oatpp::swagger::DocumentInfo>, swaggerDocumentInfo
    )([] {
        oatpp::swagger::DocumentInfo::Builder builder;
        builder
                .setTitle("凝视 service")
                .setDescription("凝视 project with swagger docs")
                .setVersion("0.0.1")
                .setContactName("Guo Dapeng")
                .setContactUrl("https://www.guodapeng.icu")

                        // .setLicenseName("Apache License, Version 2.0")
                        // .setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0")

                .addServer("http://127.0.0.1:8100", "server on localhost")
                .addSecurityScheme(
                        "basic_auth",
                        oatpp::swagger::DocumentInfo::SecuritySchemeBuilder::DefaultBearerAuthorizationSecurityScheme()
                );
        return builder.build();
    }());
    OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::swagger::Resources>, swaggerResources)([] {
        return oatpp::swagger::Resources::loadResources(OATPP_SWAGGER_RES_PATH);
    }());
};

#endif //GAZE_SWAGGERCOMPONENT_HPP
